package com.study.spark.scala.chapter10

object Scala02_Transform {
  def main(args: Array[String]): Unit = {
    // TODO 隐式转换 - implicit
    // 隐式函数
    // 代码开发遵循OCP原则，尽量不改原有的代码，增加新功能

    implicit def transform(user: User):UserExt ={
        new UserExt
    }

    val user = getUser
    user.insterUser()
    user.updateUser()

  }

  class User{
    def insterUser(): Unit ={
      println("insterUser......")
    }
  }

  class UserExt{
    def updateUser(): Unit ={
      println("updataUser......")
    }
  }

  def getUser: User ={
    new User
  }

}
